package yto.freemarker.java8.annotation;

import com.sun.istack.internal.NotNull;
import org.junit.Test;

import java.lang.reflect.Method;

/**
 * =重复注解
 * @author dongxing
 * @create 2018-06-23 19:05
 **/
public class TestMyAnnotation {

    private @NotNull
    Object object = null;

    @Test
    public void test1() throws NoSuchMethodException {
        Class<TestMyAnnotation> aClass = TestMyAnnotation.class;
        Method m1 = aClass.getMethod("show");

        MyAnnotation[] annotations = m1.getAnnotationsByType(MyAnnotation.class);
//        Arrays.stream(annotations).forEach(System.out::println);
        for (MyAnnotation annotation : annotations) {
            System.out.println(annotation.value());

        }
    }

    @MyAnnotation("hello")
    @MyAnnotation("world")
    public void show(){

    }
}
